# 清楚原系统已安装的java

#下载对应版本jdk
# https://www.oracle.com/cn/java/technologies/javase/javase8-archive-downloads.html

# 解压
mkdir /opt/java && tar -zxvf /opt/upload/jdk-8u202-linux-x64.tar.gz -C /opt/java

cd /opt/java/jdk1.8.0_202

# 安装
alternatives --install /usr/java/jdk jdk /opt/java/jdk1.8.0_202 100

# 配置环境变量
#/etc/profile追加如下内容： 

# export JAVA_HOME=/usr/java/jdk
# export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib

# export PATH=$JAVA_HOME/bin:$PATH

# 刷新生效：source /etc/profile


# 测试 
java -version